Support DDP session resumption (4.2.0) - #75
Open
tanutapi wants to merge 3 commits into
Open
Conversation
Implements the client side of meteor/meteor#14051. After an unexpected disconnect the client keeps its session id and message count and asks the server to resume; when it does, login, subscriptions and in-flight method calls carry on untouched and onReconnect callbacks are skipped. Otherwise the reconnect falls back to the previous behaviour. disconnect() now sends a DDP disconnect message so the server frees the session immediately. The mock server models the new server semantics behind a supportsResumption flag, with tests for both old and new servers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q5VJ5d285h9engGixa8Cm1
Verified against a live Meteor server through a TCP proxy: a method written to the socket just before the cut never reached the server, so a call kept pending across a resumed session hung forever - the bug 4.1.0 fixed. The client cannot tell a lost request from a slow method, so in-flight calls now fail with MeteorConnectionError once the reconnect completes, resumed or not. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q5VJ5d285h9engGixa8Cm1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
receivedCountand sends both inconnect. If the server hands the same session back, the login and subscriptions continue untouched, messages published during the gap arrive in order, andonReconnectcallbacks are not run. Otherwise the reconnect behaves exactly as before (re-login, re-subscribe).MeteorConnectionErroronce the reconnect completes, resumed or not: a request written just before the drop may never have reached the server, and that can't be told apart from a slow method (confirmed against a live server — keeping them pending hung forever).disconnect()now sends a DDPdisconnectmessage first so the server drops the session immediately instead of holding it for the grace period.DdpClient.resumedSession/receivedCountgetters. Version bumped to 4.2.0; README and CHANGELOG updated.Test plan
dart analyzecleantest/lifecycle_test.dart+test/ddp_mock_server_test.dart: 31/31 pass, repeated runs without flakestest/dart_meteor_test.dartagainst a live Meteor server with #14051: 30/30 passresumedSession == true, subsequent calls work🤖 Generated with Claude Code
https://claude.ai/code/session_01Q5VJ5d285h9engGixa8Cm1